package com.example.day0225

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.example.day0221.views.HomePage
import com.example.day0221.views.MessagePage
import com.example.day0221.views.MinePage
import com.example.apps.view.AppsPage
import com.example.document.view.DocumentPage
import com.example.document.view.LocalPage
import com.example.lib_base.RoutePath
import com.example.report.view.ReportCommitPage
import com.example.report.view.ReportPage
import com.example.sign.view.SignCommitPage
import com.example.sign.view.SignPage
import com.example.user.view.RegisterPage

@Composable
fun MyNavHost(it: PaddingValues, navHostController: NavHostController) {
    NavHost(
        modifier = Modifier.padding(it),
        navController = navHostController,
        startDestination = RoutePath.HOME,
        builder = {
            composable(RoutePath.MESSAGE) {MessagePage() }
            composable(RoutePath.HOME) { HomePage(navHostController) }
            composable(RoutePath.MINE) { MinePage(navHostController) }
            composable(RoutePath.APPS) { AppsPage(navHostController) }
            composable(RoutePath.DOCUMENT) { DocumentPage(navHostController = navHostController) }
            composable(RoutePath.LOCAL) { LocalPage(navHostController = navHostController) }
            composable(RoutePath.REPORT) { ReportPage(navHostController = navHostController) }
            composable(RoutePath.REPORT_COMMIT + "/{report}") {
                val report = it.arguments?.getString("report", "").toString()
                ReportCommitPage(json = report, navHostController = navHostController)
            }
            composable(RoutePath.SIGN) { SignPage(navHostController = navHostController) }
            composable(RoutePath.SIGN_COMMIT) { SignCommitPage(navHostController = navHostController) }
            composable(RoutePath.REGISTER) { RegisterPage(navHostController = navHostController) }

        })
}